<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <meta name="cdnload" content="vue,element-ui-js,element-ui-css" />
    <title>157-标签页通信</title>
  </head>

  <body>
    <div id="app" class="box">
      <div>
        <p>BroadcastChannel 与 postMessage 的区别是：</p>
        BroadcastChannel只能用于同源的页面之间进行通信，而postMessage却可以用于任何的页面之间的通信
      </div>
      <p>
        <a href="https://developer.mozilla.org/zh-CN/docs/Web/API/BroadcastChannel" target="_blank">
          BroadcastChannel API参考
        </a>
        <br />
        <a href="https://www.douyin.com/video/7358391486452436275" target="_blank"> 跨标签页通信，跨标签页数据共享 </a>
      </p>
      <hr />
      <!-- 新增 -->
      <div v-if="isAdd">
        <el-button type="primary" @click="addHandle">新增</el-button>
      </div>
      <!-- 列表 -->
      <div v-else>
        <el-button type="primary" @click="openAddPage">进入新增页面</el-button>
        <el-table :data="tableData">
          <el-table-column prop="id" label="编号"></el-table-column>
          <el-table-column prop="name" label="姓名"></el-table-column>
        </el-table>
      </div>
    </div>
    <script type="module" src="./157-main.js"></script>
  </body>
</html>
